#ifndef BROWSER_H
#define BROWSER_H

#include <QWidget>
class QNetworkReply;

namespace Ui {
class Browser;
}

class Browser : public QWidget
{
	Q_OBJECT
	
public:
	explicit Browser(QWidget *parent = 0);
	~Browser();

public slots:
	void load(QString url);

signals:
	void titleChanged(QString);
	void metadataDownloaded(QString);
	void pdfDownloaded(QByteArray contents, QString url);
	void newDownloadStarting(QNetworkReply *reply, QString url, QString mime);

protected slots:
	void adjustLocation();
	void changeLocation();
	void adjustTitle();
	void setProgress(int p);
	void finishLoading(bool);
	void slotFileDownloaded();
	void unsupportedContent(QNetworkReply *reply);
	
private:
	Ui::Browser *ui;
	QString jQuery;
	int progress;
	bool firstTime;
};

#endif // BROWSER_H
